let channelID;

window.onload = function (){
    channelID = getQuery("channelID");
    console.log(channelID)
    cutFindByItem(1);
}
function cutFindByItem(pageNum){
    axios.get("/mainPost/cutFindByItem",{
        params:{
            pageNum:pageNum,
            channelID:channelID,
            title:$("title").value,
            userName:$("userName").value,
            startDate:$("startDate").value,
            endDate:$("endDate").value
        }
    }).then(resp=>{
        var info = resp.data;
        var str = "";
        info.records.forEach(n =>{
            str += `<tr><td><a href="/reply.html?mainPostID=${n.id}">${n.title}</a></td><td>${n.userBean.userName}</td>
<td>${n.sumReply}</td><td>${n.date}</td><tr>`
        });
        $("data").innerHTML = str;


        var cutStr = "";
        for(var i=1;i<=info.pages;i++){
            cutStr += `<a style="margin-left: 10px" href="javascript:cutFindByItem(${i})">${i}</a>`;
        }
        $("cutDiv").innerHTML = cutStr;
    })
}